<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>动态边框</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        /* background-color: #000; */
      }

      .box {
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        margin: 100px auto;
        width: 300px;
        height: 400px;
        font-size: 40px;
        overflow: hidden;
        border-radius: 20px;
      }

      .son {
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        z-index: 5;
        inset: 5px;
        background-color: red;
        border-radius: 20px;
      }
      .box::before,
      .box::after {
        content: "";
        position: absolute;
        width: 500px;
        height: 500px;
        /* inset: 0; */
        background-image: conic-gradient(
          transparent,
          transparent,
          transparent,
          #5f27cd
        );
        animation: action 3s linear infinite;
      }

      .box::after {
        animation-delay: -1.5s;
        background-image: conic-gradient(
          transparent,
          transparent,
          transparent,
          #95a5a6
        );
      }

      @keyframes action {
        from {
          transform: rotate(0deg);
        }
        to {
          transform: rotate(360deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="son">A</div>
    </div>
  </body>
</html>
